﻿using System;
using System.Collections.Generic;
using ZyGames.DZPocker.Model;
using ZyGames.Framework.Cache.Generic;
using ZyGames.Framework.Game.Cache;
using ZyGames.Framework.Game.Context;
using ZyGames.Framework.Game.Contract;
using ZyGames.Framework.Game.Contract.Action;
using ZyGames.Framework.Game.Lang;
using ZyGames.Framework.Game.Service;
using System.Linq;
using ZyGames.DZPocker.Bll.Logic;
using ZyGames.DZPocker.Script;
using ZyGames.Framework.Net;
using ZyGames.Framework.Common.Serialization;
using System.Threading;

namespace ZyGames.DZPocker.Script.CsScript.Action
{
	/// <summary>
	/// 广播房主处理玩家申请筹码结果
	/// </summary>
	public class Action30054 : BaseAction
	{
		/// <summary>
		/// 多桌的话要用到具体是哪一桌的弹框信息
		/// </summary>
		private int tableId;
		private int userId;
		private string userName;
		//private int posId;
		/// <summary>
		/// 申请筹码的数量,用于广播, 如果大于0  其他玩家就显示房主同意某人申请多少筹码,  如果不同意就显示房主拒绝某人申请筹码
		/// </summary>
		private int applyChip;

		public Action30054(HttpGet actionGetter)
			: base((short)ActionType.DZBrocastAuditApplyChipResult, actionGetter)
		{
		}
		public override bool GetUrlElement()
		{
			if (httpGet.GetInt("TableId", ref tableId) &&
				httpGet.GetInt("UserId", ref userId) &&
				httpGet.GetString("UserName", ref userName) &&
				httpGet.GetInt("ApplyChip", ref applyChip))
			{
				return true;
			}
			return false;
		}

		public override bool TakeAction()
		{
			return true;
		}

		public override void BuildPacket()
		{
			this.PushIntoStack(this.tableId);
			this.PushIntoStack(this.userId);
			this.PushIntoStack(this.userName);
			this.PushIntoStack(this.applyChip);
		}
	}
}
